package com.cn.dai.common;

public class R<T> {
    public String code;
    public String message;
    public T data;
    public R(String code,String message){
        this.code = code;
        this.message = message;
    }
    public R(String code,String message,T data){
        this.code = code;
        this.message = message;
        this.data = data;
    }
    public static R ok(){
        return new R("0000","交易成功",null);
    }
    public static <T> R<T> ok(T data){
        return new R<>("0000","交易成功",data);
    }
    public static <T> R<T> fail(String code,String message){
        return new R<>(code,message);
    }
    public static <T> R<T> fail(String code,String message,T data){
        return new R<>(code,message,data);
    }
}
